package cn.flying.cloud.task.core.callback.handler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.lmax.disruptor.ExceptionHandler;

import cn.flying.cloud.task.core.callback.event.TransferEvent;

/**
 * @author: admin
 * @date: 2025年03月18日 17:59
 * @version: 1.0
 */
public class TransferExceptionHandler implements ExceptionHandler<TransferEvent> {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public void handleEventException(Throwable ex, long sequence, TransferEvent event) {
        logger.error("获取RingBuffer数据异常，序列：{}, 数据对象：{}", sequence, event.getData(), ex);
        throw new RuntimeException(ex);
    }

    @Override
    public void handleOnStartException(Throwable ex) {
        logger.error("启动异常！！！", ex);
    }

    @Override
    public void handleOnShutdownException(Throwable ex) {
        logger.error("异常停止！！！", ex);
    }
}
